<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //字符串反转
        // var arr=['1','2','3','4']
        // arr.reverse()
        // console.log(arr);
        // 删除字符串里的空格
        // arr.reverse()
        function computed(str) {
    //   str.trim()
    //    var a=str.split('').reverse()
    //    console.log(a);
    //    a.splice(0,1,'啊')
    //    console.log(a);
    //   a.splice(9,'W')
    //   a.splice(15,'H')
    //   console.log(a);  
    console.log(str.replace('!','啊').replace('h','H').replace('w','W').replace(' ','').replace(' ','').split().reverse().join());
        }
        computed( 'hello word 我爱你!')
         
    </script>
</body>

</html>